﻿using System;
using System.Collections.Generic;

namespace base31.Hub.Models
{
    /// <summary>
    /// Represents a feed that we know exists.
    /// This entity will be overwritten anytime someone subscribes to this feed. The
    /// benefit is we have a single entity per known feed, allowing us to quickly
    /// iterate through all of them. This may have issues if the subscription rate
    /// for a single feed is over one per second.
    /// </summary>
    public class KnownFeed
    {
        public string Topic { get; set; }
        public string FeedId { get; set; }
        public DateTime UpdateTime { get; set; }

        /// <summary>
        /// Creates a new KnownFeed.
        /// </summary>
        /// <param name="topic">The feed's topic URL.</param>
        /// <returns>The KnownFeed instance that hasn't been added to the Datastore.</returns>
        public KnownFeed Create(string topic)
        {
            return null;
        }

        /// <summary>
        /// Enqueues a task to create a new KnownFeed and initiate feed ID discovery.
        /// </summary>
        /// <param name="topic">The feed's topic URL.</param>
        public void Record(string topic)
        {
        }

        /// <summary>
        /// Creates a key for a KnownFeed.
        /// </summary>
        /// <param name="topic">The feed's topic URL.</param>
        /// <returns>Key instance for this feed.</returns>
        public string CreateKey(string topic)
        {
            return String.Empty;
        }

        /// <summary>
        /// Checks if the supplied topic URLs are known feeds.
        /// </summary>
        /// <param name="topics">Iterable of topic URLs.</param>
        /// <returns>List of topic URLs with KnownFeed entries. If none are known, this list
        /// will be empty. The returned order is arbitrary.</returns>
        public List<string> CheckExists(List<string> topics)
        {
            return null;
        }
    }
}